<template>
  <div class="item-detail">
    <div class="page-header">
      <div class="header-top">
        <button class="back-btn" @click="$router.back()">← 返回</button>
        <h1>物品详情</h1>
        <div class="header-actions">
          <button class="favorite-btn">♡ 收藏</button>
        </div>
      </div>
    </div>
    
    <div class="detail-content">
      <div class="item-gallery">
        <div class="main-image">
          <div class="image-placeholder">📚</div>
        </div>
        <div class="thumbnail-images">
          <div class="thumbnail active">📚</div>
          <div class="thumbnail">📖</div>
          <div class="thumbnail">📘</div>
        </div>
      </div>
      
      <div class="item-info">
        <div class="info-header">
          <h2>环保生活指南</h2>
          <div class="item-price">免费交换</div>
        </div>
        
        <div class="item-meta">
          <div class="meta-item">
            <span class="meta-label">分类:</span>
            <span class="meta-value">书籍</span>
          </div>
          <div class="meta-item">
            <span class="meta-label">成色:</span>
            <span class="meta-value">9成新</span>
          </div>
          <div class="meta-item">
            <span class="meta-label">距离:</span>
            <span class="meta-value">2.5km</span>
          </div>
          <div class="meta-item">
            <span class="meta-label">发布时间:</span>
            <span class="meta-value">2小时前</span>
          </div>
        </div>
        
        <div class="item-description">
          <h3>物品描述</h3>
          <p>这是一本关于可持续生活方式的实用指南，涵盖了从日常饮食到家庭清洁的各种环保技巧。书中提供了大量易于实践的建议，帮助读者减少碳足迹，过上更环保的生活。</p>
          <p>书籍保存完好，无污渍，封面略有磨损。</p>
        </div>
        
        <div class="exchange-safety">
          <h3>交换安全提示</h3>
          <ul>
            <li>请在公共场所进行交换，确保人身安全</li>
            <li>交换前请仔细检查物品状况</li>
            <li>建议使用平台推荐的交流方式</li>
            <li>如遇纠纷，请及时联系平台客服</li>
          </ul>
        </div>
        
        <div class="item-actions">
          <button class="contact-btn">联系发布者</button>
          <button class="report-btn">举报物品</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
// 物品详情页面逻辑可以在这里添加
</script>

<style scoped>
.item-detail {
  padding: 20px;
  width: 100%;
  box-sizing: border-box;
}

.page-header {
  margin-bottom: 30px;
  padding: 20px;
  background: white;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-header h1 {
  font-size: 2rem;
  margin: 0;
  color: #2c3e50;
  flex: 1;
  text-align: center;
}

.back-btn, .favorite-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.back-btn {
  background-color: #f8f9fa;
  color: #495057;
}

.back-btn:hover {
  background-color: #e9ecef;
}

.favorite-btn {
  background-color: #f8f9fa;
  color: #495057;
}

.favorite-btn:hover {
  background-color: #ffebee;
  color: #e91e63;
}

.detail-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
  box-sizing: border-box;
}

.item-gallery {
  background: white;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  padding: 20px;
  box-sizing: border-box;
}

.main-image {
  height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f8f9fa;
  border-radius: 10px;
  margin-bottom: 20px;
}

.image-placeholder {
  font-size: 8rem;
}

.thumbnail-images {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.thumbnail {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f8f9fa;
  border-radius: 8px;
  font-size: 2rem;
  cursor: pointer;
  transition: all 0.3s;
}

.thumbnail:hover,
.thumbnail.active {
  border: 2px solid #42b983;
  background-color: #e9f7ef;
}

.item-info {
  background: white;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  padding: 30px;
  box-sizing: border-box;
}

.info-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 15px;
}

.info-header h2 {
  margin: 0;
  color: #2c3e50;
  font-size: 1.8rem;
}

.item-price {
  background-color: #42b983;
  color: white;
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 1.1rem;
}

.item-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 30px;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: 10px;
  box-sizing: border-box;
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-weight: bold;
  color: #495057;
  margin-bottom: 5px;
}

.meta-value {
  color: #6c757d;
}

.item-description h3,
.exchange-safety h3 {
  color: #2c3e50;
  margin: 0 0 15px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.item-description p {
  color: #6c757d;
  line-height: 1.6;
  margin-bottom: 15px;
}

.exchange-safety ul {
  padding-left: 20px;
  margin: 0;
}

.exchange-safety li {
  color: #6c757d;
  margin-bottom: 10px;
  line-height: 1.5;
}

.item-actions {
  display: flex;
  gap: 15px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.contact-btn, .report-btn {
  padding: 15px 30px;
  border: none;
  border-radius: 25px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  flex: 1;
  min-width: 150px;
  white-space: nowrap;
}

.contact-btn {
  background-color: #42b983;
  color: white;
}

.contact-btn:hover {
  background-color: #359c6d;
  transform: scale(1.02);
}

.report-btn {
  background-color: #f8f9fa;
  color: #495057;
}

.report-btn:hover {
  background-color: #e9ecef;
}

@media (max-width: 768px) {
  .detail-content {
    grid-template-columns: 1fr;
  }
  
  .page-header h1 {
    font-size: 1.5rem;
  }
  
  .info-header h2 {
    font-size: 1.5rem;
  }
  
  .item-meta {
    grid-template-columns: 1fr;
  }
  
  .main-image {
    height: 300px;
  }
  
  .item-actions {
    flex-direction: column;
  }
  
  .contact-btn, .report-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .item-detail {
    padding: 15px;
  }
  
  .page-header {
    padding: 15px;
  }
  
  .header-top {
    flex-direction: column;
    gap: 15px;
  }
  
  .item-info {
    padding: 20px;
  }
  
  .main-image {
    height: 250px;
  }
  
  .thumbnail {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }
  
  .contact-btn, .report-btn {
    padding: 12px 20px;
  }
}
</style>